package leetcode;

import java.util.*;
class ListNode {
    int val;
    ListNode next;
    ListNode() {}
    ListNode(int val) { this.val = val; }
    ListNode(int val, ListNode next) { this.val = val; this.next = next; }
}
public class LeetCodeMain68 {
    List<List<String>> res=new ArrayList<>();
    public List<List<String>> solveNQueens(int n) {
        char[][] board=new char[n][n];
        for (int i = 0; i < n; i++) {
            Arrays.fill(board[i],'.');
        }
        back(board,0);
        return res;
    }
    public void back(char[][] board,int x){
        if (x==board.length){
            List<String> list=new ArrayList<>();
            for (char[] ch:board) {
                list.add(String.copyValueOf(ch));

            }
            res.add(list);
            return;
        }
        for (int i = 0; i < board[0].length; i++) {
            if (isVaild(board,x,i)){
                board[x][i]='Q';
                back(board, x+1);
                board[x][i]='.';
            }
        }
    }
    public boolean isVaild(char[][] board,int x,int y){
        if (x==board.length||y==board[0].length){
            return false;
        }
        for (int i = x-1; i >= 0; i--) {
            if (board[i][y]=='Q'){
                return false;
            }
        }
        for (int i = y-1; i >= 0; i--) {
            if (board[x][i]=='Q'){
                return false;
            }
        }
        for (int i = x-1,j=y-1; i >= 0&&j>=0; i--,j--) {
            if (board[i][j] == 'Q') {
                return false;
            }
        }
        for (int i=x-1,j=y+1;i>=0&&j<board[0].length;i--,j++){
            if (board[i][j] == 'Q') {
                return false;
            }
        }
        return true;
    }














    public ListNode sortList(ListNode head) {
        if (head==null){
            return null;
        }
        PriorityQueue<ListNode> queue=new PriorityQueue<>((o1, o2) -> o1.val-o2.val);
        while (head!=null){
            queue.add(head);
            head=head.next;
        }
        ListNode n1=new ListNode(-1);
        ListNode n2=n1;
        while (!queue.isEmpty()){
            n2.next=queue.poll();
            n2=n2.next;
        }
        n2.next=null;
        return n1.next;
    }
    public List<String> list=new ArrayList<>();
    public StringBuffer buffer=new StringBuffer();
    String[] str1=new String[]{"","","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
    public List<String> letterCombinations(String digits) {
        if (digits==null||digits.length()==0){
            return null;
        }
        back(digits,0);
        return list;
    }
    public void back(String digits,int startIndex){
        if (buffer.length()==digits.length()){
            list.add(buffer.toString());
            return;
        }
        int index=digits.charAt(startIndex)-'0';
        for (int i = 0; i < str1[index].length(); i++) {
            buffer.append(str1[index].charAt(i));
            back(digits,startIndex+1);
            buffer.deleteCharAt(buffer.length()-1);
        }
    }
    int[][] nextP={{1,0},{-1,0},{0,1},{0,-1}};
    public int count=0;
    public void DFS(int[][] grid, int row, int col, int curX, int curY){
        grid[curX][curY]=0;
        count++;
        for (int i = 0; i < 4; i++) {
            int newX=curX+nextP[i][0];
            int newY=curY+nextP[i][1];
            if (newX<0||newY<0||newX>=row||newY>=col){
                continue;
            }
            if (grid[newX][newY]==1){
                DFS(grid, row, col, newX, newY);
            }
        }
    }
    public int maxAreaOfIsland(int[][] grid) {
        if (grid==null){
            return 0;
        }
        int max=0;
        int row=grid.length;
        int col=grid[0].length;
        for (int i = 0; i < row; i++) {
            for (int j = 0; j < col; j++) {
                if (grid[i][j]=='1'){
                    DFS(grid,row,col,i,j);
                    max=Math.max(max,count);
                    count=0;
                }
            }
        }
        return max;
    }
    public void dfs(char[][] grid, int row, int col, int curX, int curY){
        grid[curX][curY]='0';
        for (int i = 0; i < 4; i++) {
            int newX=curX+nextP[i][0];
            int newY=curY+nextP[i][1];
            if (newX<0||newY<0||newX>=row||newY>=col){
                continue;
            }
            if (grid[newX][newY]=='1'){
                dfs(grid, row, col, newX, newY);
            }
        }
    }
    public int numIslands(char[][] grid) {
        if (grid==null){
            return 0;
        }
        int count=0;
        int row=grid.length;
        int col=grid[0].length;
        for (int i = 0; i < row; i++) {
            for (int j = 0; j < col; j++) {
                if (grid[i][j]=='1'){
                    count++;
                    dfs(grid,row,col,i,j);
                }
            }
        }
        return count;
    }

    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        while (true){
            int monkeyNum=in.nextInt();
            if (monkeyNum==0){
                break;
            }
            long sum= (long) Math.pow(5,monkeyNum)-4;
            long sum1=(long) Math.pow(4,monkeyNum)+monkeyNum-4;
            System.out.printf("%d %d\n",sum,sum1);
        }
    }
    public static void main1(String[] args) {
//        int i=5;
//        int s=(i++)+(++i)+(i--)+(--i);
//        System.out.println(s);
//        Object o=new Object();
        int i=0;
        int j=0;
        if ((++i>0)||(++j>0)){
            System.out.println(i);
            System.out.println(j);
        }
    }
}
